﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz;

namespace WeChartWorkRobot.Service.Jobs
{
    public class ImmediatelyTrigger : TriggerBase
    {
        private readonly TriggerBase _nextTrigger;

        public ImmediatelyTrigger(TriggerBase nextTrigger)
        {
            _nextTrigger = nextTrigger;
        }

        protected internal override ITrigger GetQuartzTrigger()
        {
            return TriggerBuilder.Create().StartNow().Build();
        }

        public override DateTimeOffset? GetNextRunTime()
        {
            return _nextTrigger?.GetFirstRunTime();
        }
    }
}
